<template>
	<view>
		<view v-if="islog" class="flex j-c a-c" style="height: 180rpx;background-color: #fff;">
			<image style="width: 50rpx;height: 50rpx;" src="@/static/lo.gif"></image>
		</view>
		<view v-if="!islog" class="pr2 pl2 pb2" v-for="(item,index) in list" :key="index">
			<view class="p20 b_y flex" style="background-color: #fff;display: flex;justify-content: space-around;">
				<view class="" style="position: relative;width: 160rpx;height: 160rpx;">
					<image class="b_y" style="width: 160rpx;height: 160rpx;position: absolute;z-index: 9;" :src="item.pic">
					</image>
				</view>
				<view style="margin-left: 10rpx;width:450rpx;">
					<text class="f30 w800 ml1 yihang" style="width: 350rpx;font-size: 40rpx;">{{item.name}}</text>
					<text class="f30 w800 ml1 yihang"
						style="width: 350rpx;color: #c2c2c2;margin-top: 30rpx;">{{item.createDate}}</text>
					<text class="f30 w800 ml1 yihang"
						style="width: 350rpx;color: #c2c2c2;margin-top: 30rpx;">{{item.state==2?'商家审核通过':
								item.state==3?'商家审核未通过':item.state==4?'平台审核通过':item.state==5?'平台审核未通过':item.state==6?'审核通过':item.state==7?'订单已取消':''
								}}</text>
					<text class="f30 w800 ml1 yihang"
						style="width:350rpx;color:#eb1212;margin-top:5rpx;">{{item.state==5?item.reason:''}}</text>
				</view>
				<view @click="on_tel(item.shop_tel)" class="pt3 t_c">
					<image v-if="item.platform==1" style="width: 50rpx;height: 50rpx;" src="@/static/tab/mt.png"></image>
					<image v-if="item.platform==2" style="width: 50rpx;height: 50rpx;" src="@/static/tab/elm.png"></image>
					<view class="f24 c_7" v-if="item.distance>0">
						<text></text>
					</view>
				</view>
			</view>
			<view style="display:flex;justify-content:flex-end;" class="boxstyle" v-if="itype==1">
				<view class="but_audit" v-if="item.state==0 && timeStamp(item.createTime)" @click="cancel(item)"
					:style="'border:2rpx solid #999;color:#999;margin-right:20rpx;'">取消订单</view>
				<view class="but_audit" v-if="item.state==0" @click="views(item,1)"
					:style="item.platform==1?'background-color:#FDC400;':'background-color:#0192FF;'">提交信息</view>
			<!-- 	<view class="but_audit" v-if="item.state==3||item.state==5" @click=""
					:style="'border:2rpx solid #999;color:#999;margin-right:20rpx;'">申诉
				</view> -->
			</view>
			<view style="display:flex;justify-content:flex-end;" class="boxstyle" v-if="item.state==1">
				<view class="but_audit" v-if="examineType==1&&itype==2" @click="views(item,2)"
					:style="item.platform==1?'background-color:#FDC400;':'background-color:#0192FF;'">进行审核</view>
					<view class="but_audit" v-if="examineType==2&&itype==3" @click="views(item,2)"
						:style="item.platform==1?'background-color:#FDC400;':'background-color:#0192FF;'">进行审核</view>
			</view>
		</view>
		<view v-if="!islog&&list.length==0" class="flex j-c a-c" style="background-color: #fff;">
			<image src="../../static/tab/null.png" style="width:400rpx;height:400rpx;margin-top: 40rpx;" mode="aspectFill"></image>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			options: {
				type: Object,
				default: function(e) {
					return {}
				}
			},
			list: {
				type: Array,
				default: function() {
					return [] //数据
				},
			},
			islog: {
				type: Boolean, //是否显示边框
				default: true
			},
			log: {
				type: String,
				default: ''
			},
			qiniu: {
				type: String,
				default: ''
			},
			tabindex: {
				type: Number,
				default: 0
			},
			index: {
				type: Number,
				default: 0
			},
			time: {
				type: Number,
				default: 0
			},
			type: {
				type: Number,
				default: 0
			},
		},
		data() {
			return {
				itype: '',
				examineType: '',
				lat: '',
				lng: '',
			}
		},
		created() {
			this.itype = uni.getStorageSync('user').itype
		},
		mounted() {
			this.itype = uni.getStorageSync('user').itype
			this.examineType = uni.getStorageSync('publis').examineType
		},
		methods: {
			timeStamp(timestamp) {
				var curTimestamp = parseInt(new Date().getTime()); //当前时间戳
				var timestampDiff = (curTimestamp - timestamp) / 1000; // 参数时间戳与当前时间戳相差秒数
				if (timestampDiff < 7200) { // 2小时前之内
					return true
				} else {
					return false
				}
			},
			cancel(e) { //取消订单
				// this.times()
				// 判断是否过去了定义的取消时间
				// return
				this.$module.subScribeMsg()
				var that = this;
				uni.showModal({
					title: '',
					content: '是否取消订单?',
					cancelText: "取消", // 取消按钮的文字
					confirmText: "是", // 确认按钮的文字
					success: function(ret) {
						if (ret.confirm) {
							that.$module.showLoading('取消中...')
							let data = {
								data
							}
							that.$module.sm(e, 1, res => {
								data.data = res
							})
							that.Htpp.post('/mehrb/meplus/order/delete', 'app', {
								datalist: data
							}).then(ret => {
								that.$module.sm(ret, 2, res => {
									that.$emit('myEven') // 更新列表
								})
							})
						}
					}
				});
			},
			views(item, t) {
				this.$module.subScribeMsg()
				this.$module.navigateTo('/pages/views/user_audit?item=' + JSON.stringify(item) + '&type=' + t)
			},
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}

	.boxstyle {
		border-bottom: 2rpx solid #e6e6e6;
		padding-bottom: 20rpx;
	}

	.but_audit {
		display: inline-block;
		padding: 10rpx 20rpx;
		border-radius: 10rpx;
		color: #fff;
	}

	.ff {
		padding: 8rpx 14rpx;
		color: #fff;
		border-radius: 20rpx;
		font-size: 25rpx;
	}

	.mc {
		position: absolute;
		background-color: #4e4e4ec7;
		color: #fff;
		text-align: center;
		z-index: 999;
		line-height: 160rpx;
		width: 160rpx;
		height: 160rpx;
	}
</style>